package com.huiquan.vocab.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.vocab.domain.VocabElementWildcard;
import com.huiquan.vocab.domain.VocabElementWildcardDto;
import com.huiquan.vocab.domain.VocabWildcard;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class VocabElementWildcardDao extends EnhancedBaseDao<VocabElementWildcard> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "VOCAB_ELEMENT_WILDCARD.";

	public VocabElementWildcardDao() {
		super(space);
	}

	public void updateCheckFlagByIds(String ids, int checkFlag) {
		Map<String, Object> param = new HashMap<>();
		param.put("ids", ids);
		param.put("checkFlag", checkFlag);
		
		this.update(space + "UPDATE_CHECK_FLAG_BY_IDS", param, sqlMapClient);
	}

	@SuppressWarnings("unchecked")
	public List<VocabElementWildcardDto> retrieveDtoList(Map<String, Object> param) {
		return (List<VocabElementWildcardDto>)this.list(space + "RETRIEVE_DTO_LIST", param, sqlMapClient);
	}

	public VocabElementWildcardDto retrieveDtoById(String id) {
		return (VocabElementWildcardDto)this.object(space + "RETRIEVE_DTO_BY_ID", id, sqlMapClient);
	}

	public void initByWildCard(VocabWildcard vw) {
		this.insert(space + "INIT", vw, sqlMapClient);
	}
}
